package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.ExitRegistrate;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.ExitRegistrateMapper;
import com.neuedu.hcp.service.IExitRegistrateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class ExitRegistrateServiceImpl extends ServiceImpl<ExitRegistrateMapper, ExitRegistrate> implements IExitRegistrateService {

    @Autowired
    private ExitRegistrateMapper exitRegistrateMapper;
    /**
     * 获取所有康复计划（分页）
     * @param currentPage
     * @param size
     * @param exitRegistrate
     * @return
     */
    @Override
    public RespPageBean getExitListByPage(Integer currentPage, Integer size, ExitRegistrate exitRegistrate) {
        Page<ExitRegistrate> page = new Page<>(currentPage,size);
        IPage<ExitRegistrate> exitRegistrateIPage=exitRegistrateMapper.getExitListByPage(page,exitRegistrate);
        RespPageBean respPageBean = new RespPageBean(exitRegistrateIPage.getTotal(),exitRegistrateIPage.getRecords());
        return respPageBean;

    }

    @Override
    public int insert(ExitRegistrate exitRegistrate) {
        return exitRegistrateMapper.insert(exitRegistrate);
    }

}
